package com.imooc.bilibili.service;

import com.imooc.bilibili.dao.AuthRoleDao;
import com.imooc.bilibili.domain.auth.AuthRoleElementOperation;
import com.imooc.bilibili.domain.auth.AuthRoleMenu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Service
public class AuthRoleService {

    @Autowired
    private AuthRoleDao authRoleDao;

    @Autowired
    private AuthRoleMenuService authRoleMenuService;

    @Autowired
    private AuthRoleElementOperationService authRoleElementOperationService;

    /**
     * 获取角色的操作权限
     * @param roleIdSet
     * @return
     */
    public List<AuthRoleElementOperation> getRoleElementOperationsByRoleIds(Set<Long> roleIdSet) {
        List<AuthRoleElementOperation> authRoleElementOperations = authRoleElementOperationService.getRoleElementOperationsByRoleIds(roleIdSet);
        return authRoleElementOperations;
    }

    /**
     * 获取角色的页面菜单权限
     * @param roleIdSet
     * @return
     */
    public List<AuthRoleMenu> getAuthRoleMenusByRoleIds(Set<Long> roleIdSet) {
       return authRoleMenuService.getAuthRoleMenusByRoleIds(roleIdSet);
    }
}
